<template>
  <div class="sence-card">
    <div class="card">
      <div class="card-container">
        <el-image
          :src="senceInfo.url"
          fit="fill"
          style="width: 100%; height: 100%"
        />
        <div v-show="handler" class="card-icon">
          <div>
            <i class="el-icon-info" @click.stop="infoFun" />
          </div>
          <div>
            <span class="iconfont icon-star" @click.stop="debugFun" />
          </div>
        </div>
      </div>
      <div class="card-title">
        <div>
          <i class="el-icon-monitor" />
        </div>
        <div>{{ senceInfo.name }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    senceInfo: {
      type: Object,
      default: () => ({})
    },
    handler: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    infoFun() {
      this.$emit('showMask')
      this.$emit('changeMode', 'info')
    },
    debugFun() {
      this.$emit('showMask')
      this.$emit('changeMode', 'handler')
    }
  }
}
</script>

<style lang="scss" scoped>
.sence-card {
  position: relative;

  .card {
    width: 320px;
    height: 302px;
    margin: 15px 0px;
    margin-left: 15px;
    margin-right: 70px;
    padding: 10px 10px 22px;
    border: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    user-select: none;
    .card-container {
      width: 100%;
      height: 227px;
      border: 1px solid #eaeaea;
      position: relative;

      .card-icon {
        width: 30px;
        height: 65px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-around;
        position: absolute;
        right: 5px;
        top: 5px;
        .el-icon-info {
          color: #6e7a8e;
          font-size: 28px;
        }
        .iconfont.icon-star {
          color: #6e7a8e;
          font-size: 28px;
        }
      }
    }
    .card-title {
      flex: 1;
      margin: 10px 0;
      color: #5e5e5e;
      font-size: 16.8px;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      div:first-child {
        width: 28px;
        height: 28px;
        .el-icon-monitor {
          font-size: 28px;
          margin-right: 4px;
        }
      }
      div:last-child {
        line-height: 27px;
        text-align: center;
      }
    }
    &:hover {
      transform: scale(1.08);
      transition: all ease 0.5s;
      cursor: pointer;
      box-shadow: 10px 10px 8px rgba(0, 0, 0, 0.3);
      .card-icon {
        .el-icon-info {
          color: #eaeaea;
        }
        .iconfont.icon-star {
          color: #eaeaea;
        }
      }
    }
  }
}
</style>
